//Include our Windows Application File
#include "cljmudx10winapp.h"
#include "mydx10gameapp.h"


//////////////////////////////////////////////////
// This is the Windows Main Entry Point for our
// DirectX 10 Based Game Application.  
//
//////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
{
	//Declare a pointer to our windows application and a boolean to hold the initialise success state
	CDX10WindowsApplication*	twindowsapp;
	CDX10BaseApplication*		tgameapp;
	bool						tinitsuccess;
		
	// Create an Instance of our Concrete Game Implementation.
	tgameapp = new CMyDX10GameApp();
	tgameapp->setAppName(L"Simple Sprite Demo");
	tgameapp->setBGColour(0.0f,0.0f,0.0f,1.0f);
	tgameapp->setPrefScreenDimensions(1024,768);
	tgameapp->setFullScreen(false);
	tgameapp->setVSyncEnabled(false);
	tgameapp->setCamFarPlane(1000.0f);
	tgameapp->setCamNearPlane(0.1f);
	tgameapp->setImageDataDir(L"Assets/Images/");
	tgameapp->setShaderDataDir(L"Assets/HLSL/");
	tgameapp->setSpriteDataDir(L"Assets/Sprites/");
	tgameapp->setAudioDataDir(L"Assets/Audio/");

	if(!tgameapp)
		return 0;

	//Create an Instance of our Windows Application, passing our concrete game as a parameter
	twindowsapp = new CDX10WindowsApplication(tgameapp);
	if(!twindowsapp)
		return 0;
	
	// Initialize and run the Windows App Object (only if no initialisation errors occured)
	tinitsuccess = twindowsapp->initialise();
	
	//Start the Game Loop Process - This will exit when Escape or Alt-F4 are pressed.
	if(tinitsuccess)
		twindowsapp->appStart();

	// Shutdown and release the system object.
	twindowsapp->cleanup();
	
	//Release the Memory associated with our application instance
	delete twindowsapp;
	
	//Reset the Pointer to Zero Memory Location
	twindowsapp = 0;

	//Exit the Application and Return Zero to indicate everything went smoothly
	return 0;
}